tongfusoft.index = function() {
}

tongfusoft.index.prototype = {
		
		//我的关注
		myConcernList : function(pageIndex,pageSize) {
			common.post('personalCenter/userFollows/query',{"pageIndex":pageIndex,"pageSize":pageSize},function(data){
				var myConcernListHtml = '';
			$.each(data.list,function(index,item){
					myConcernListHtml=myConcernListHtml+'<a href="#" docname="'+item.docName+'" onclick="new tongfusoft.index().detail(this)" class="list-group-item">';
					myConcernListHtml=myConcernListHtml+'<div class="media-box">';
					myConcernListHtml=myConcernListHtml+'<div class="pull-left">';
					myConcernListHtml=myConcernListHtml+'<img src="'+common.getContextPath('img/dc/'+item.docIcon)+'" alt="Image" class="media-box-object thumb64"/>';
					myConcernListHtml=myConcernListHtml+'</div>';
					myConcernListHtml=myConcernListHtml+'<div class="media-box-body clearfix">';
					myConcernListHtml=myConcernListHtml+'<strong class="media-box-heading text-default">';
					myConcernListHtml=myConcernListHtml+''+item.docTitle+'';
					myConcernListHtml=myConcernListHtml+'</strong>';
					myConcernListHtml=myConcernListHtml+'<p class="mb-sm"> <small  title="'+item.docSummary+'"  >'+item.docSummary.substr(0,50)+"....." +'</small></p>';
					

					myConcernListHtml=myConcernListHtml+'<p class="mb-sm"> <small><em class="fa fa-user mr-sm"> </em><span class="mr">'+item.docAuthor +'</span><em class="fa fa-building mr-sm"> </em><span class="mr">'+ item.lastUpdDate+'</span></small></p>';
					myConcernListHtml=myConcernListHtml+'</div>';
					myConcernListHtml=myConcernListHtml+'</div>';
					myConcernListHtml=myConcernListHtml+'</a>';
				
			});
			$("#myConcernList").html(myConcernListHtml);

			});
		},
		//我的收藏
		myCollectionList : function(pageIndex,pageSize) {
			common.post('myFavorite/query',{"pageIndex":pageIndex,"pageSize":pageSize},function(data){
				var myCollectionListHtml = '';
			$.each(data.list,function(index,item){
				myCollectionListHtml=myCollectionListHtml+'<a href="#" docname="'+item.docName+'" onclick="new tongfusoft.index().detail(this)" class="list-group-item">';
				myCollectionListHtml=myCollectionListHtml+'<div class="media-box">';
				myCollectionListHtml=myCollectionListHtml+'<div class="pull-left">';
				myCollectionListHtml=myCollectionListHtml+'<img src="'+common.getContextPath('img/dc/'+item.docIcon)+'" alt="Image" class="media-box-object thumb64"/>';
				myCollectionListHtml=myCollectionListHtml+'</div>';
				myCollectionListHtml=myCollectionListHtml+'<div class="media-box-body clearfix">';
				myCollectionListHtml=myCollectionListHtml+'<strong class="media-box-heading text-default">';
				myCollectionListHtml=myCollectionListHtml+''+item.docTitle+'';
				myCollectionListHtml=myCollectionListHtml+'</strong>';
				myCollectionListHtml=myCollectionListHtml+'<p class="mb-sm"> <small  title="'+item.docSummary+'"  >'+item.docSummary.substr(0,50)+"....." +'</small></p>';
				myCollectionListHtml=myCollectionListHtml+'<p class="mb-sm"> <small><em class="fa fa-user mr-sm"> </em><span class="mr">'+item.docAuthor +'</span><em class="fa fa-building mr-sm"> </em><span class="mr">'+ item.lastUpdDate+'</span></small></p>';
				myCollectionListHtml=myCollectionListHtml+'</div>';
				myCollectionListHtml=myCollectionListHtml+'</div>';
				myCollectionListHtml=myCollectionListHtml+'</a>';
				
			});
			$("#myCollectionList").html(myCollectionListHtml);

			});
		},
		//最新文档
		myDocList : function(pageIndex,pageSize) {
			common.post('docSearch/query',{"pageIndex":pageIndex,"pageSize":pageSize},function(data){
				var myDocListHtml = '';
			$.each(data.list,function(index,item){
				myDocListHtml=myDocListHtml+'<a href="#" docname="'+item.docName+'" onclick="new tongfusoft.index().detail(this)" class="list-group-item">';
				myDocListHtml=myDocListHtml+'<div class="media-box">';
				myDocListHtml=myDocListHtml+'<div class="pull-left">';
				myDocListHtml=myDocListHtml+'<img src="'+common.getContextPath('img/dc/'+item.docIcon)+'" alt="Image" class="media-box-object thumb64"/>';
				myDocListHtml=myDocListHtml+'</div>';
				myDocListHtml=myDocListHtml+'<div class="media-box-body clearfix">';
				myDocListHtml=myDocListHtml+'<strong class="media-box-heading text-default">';
				myDocListHtml=myDocListHtml+''+item.docTitle+'';
				myDocListHtml=myDocListHtml+'</strong>';
				myDocListHtml=myDocListHtml+'<p class="mb-sm"> <small  title="'+item.docSummary+'"  >'+item.docSummary.substr(0,50)+"....." +'</small></p>';
				myDocListHtml=myDocListHtml+'<p class="mb-sm"> <small><em class="fa fa-user mr-sm"> </em><span class="mr">'+item.docAuthor +'</span><em class="fa fa-building mr-sm"> </em><span class="mr">'+ item.lastUpdDate+'</span></small></p>';
				myDocListHtml=myDocListHtml+'</div>';
				myDocListHtml=myDocListHtml+'</div>';
				myDocListHtml=myDocListHtml+'</a>';
				
			});
			$("#myDocList").html(myDocListHtml);
			});
		},
		
		//自定义查询
		mySearchList : function(pageIndex,pageSize) {
			common.post('queryCriteria/list',{"pageIndex":pageIndex,"pageSize":pageSize},function(data){
				var mySearchListHtml = '';
			$.each(data.data,function(index,item){
				mySearchListHtml=mySearchListHtml+'<a href="#" csId="'+item.csId+'" onclick="new tongfusoft.index().searchResult(this)" class="list-group-item">';
				mySearchListHtml=mySearchListHtml+'<div class="media-box">';
				mySearchListHtml=mySearchListHtml+'<div class="pull-left">';
				mySearchListHtml=mySearchListHtml+'</div>';
				mySearchListHtml=mySearchListHtml+'<div class="media-box-body clearfix">';
				mySearchListHtml=mySearchListHtml+'<strong class="media-box-heading text-default">';
				mySearchListHtml=mySearchListHtml+''+item.csName+'';
				mySearchListHtml=mySearchListHtml+'</strong>';
				mySearchListHtml=mySearchListHtml+'</div>';
				mySearchListHtml=mySearchListHtml+'</div>';
				mySearchListHtml=mySearchListHtml+'</a>';
				
			});
			$("#mySearchList").html(mySearchListHtml);
			});
		},
		//详情
		detail : function(obj){
			window.location.href=common.getContextPath('docView/'+$("#returnPage").val()+'/'+$(obj).attr("docName"));
		},
		//自定义查询结果页（搜索页）
		searchResult : function(obj){
			$("#oper").val("search");
			$("#csId").val($(obj).attr("csId"));
			$("#advancedQueryForm").submit();
			
			
		},
		//查询
		searchBtn:function(){
			
			$("#submitBtn").click(function(){
				
				$("#advancedQueryForm").submit();
			});
			
			
		}
}

$(function(){
	var obj= new tongfusoft.index();
	obj.mySearchList(1,5);
	obj.myConcernList(1,5);
	obj.myCollectionList(1,5);
	obj.myDocList(1,3);
	obj.searchBtn();
})